import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'

Vue.use(Router)

var router = new Router({
  routes: [
    {
      path: '/',
      redirect:'/Index',
      name: 'HelloWorld',
      component: ()=>import('@/components/HelloWorld')
    },
    {
      path:'/login',
      name:'login',
      component:()=>import('@/views/Login'),
      meta:{
        title:'登录'
      }
    },
    {
      path:'/sla',
      name:'Sla',
      component:()=>import('@/views/Sla'),
      meta:{
        title:'服务协议'
      }
    },
    {
      path:'/index',
      name:'Index',
      component:()=>import('@/views/Index'),
      meta:{
        title:'首页'
      }
    },
    {
      path:'/reg',
      name:'Reg',
      component:()=>import('@/views/Reg'),
      meta:{
        title:'注册'
      }
    },
    {
      path:'/shouye',
      name:'Shouye',
      redirect:'/home',
      component:()=>import('@/views/Shouye'),

      children:[
          {
            path:'/home',
            name:'Home',
            component:()=>import('@/views/Home'),
            meta:{
              title:'星选商城'
            },

          },
          {
            path:'/search',
            name:'Search',
            component:()=>import('@/views/Search'),
            meta:{
              title:'私享体验'
            },
          },
          {
            path:'/setting',
            name:'Setting',
            component:()=>import('@/views/Setting'),
            meta:{
              title:'设置'
            },
          },
          {
            path:'/cart',
            name:'Cart',
            component:()=>import('@/views/Cart'),
            meta:{
            title:'购物车'
            },
          }
       ]
    },
    {
      path:'/seek',
      name:'Seek',
      component:()=>import('@/views/Seek'),
      meta:{
        title:'搜索中'
      }
    },
    {
      path:'/news',
      name:'News',
      component:()=>import('@/views/News'),
      meta:{
        title:'消息'
      }
    },
    {
      path:'/message',
      name:'Message',
      component:()=>import('@/views/Message'),
      meta:{
        title:'个人中心'
      }
    },
    {
      path:'/detail/:id',
      name:'Detail',
      component:()=>import('@/views/Detail'),
      meta:{
        title:'详情'
      },
    },
    {
      path:'*',
      name:'Err',
      component:()=>import('@/views/Err'),
    },
    {
      path:'/editor',
      name:'Editor',
      component:()=>import('@/views/Editor'),
      meta:{
        title:'设置昵称'
      }
    },
    {
      path:'/more',
      name:'More',
      component:()=>import('@/views/More'),
      meta:{
        title:'更多设置'
      }
    },
    {
      path:'/oproblem',
      name:'Oproblem',
      component:()=>import('@/views/Oproblem'),
      meta:{
        title:'订单问题'
      }
    },
    {
      path:'/service',
      name:'Service',
      component:()=>import('@/views/Service'),
      meta:{
        title:'联系客服'
      }
    },
    {
      path:'/orders',
      name:'Orders',
      component:()=>import('@/views/Orders'),
      meta:{
        title:'星选订单'
      }
    },
    {
      path:'/address',
      name:'Address',
      component:()=>import('@/views/Address'),
      meta:{
        title:'收货地址'
      }
    },
    {
      path:'/newadd',
      name:'Newadd',
      component:()=>import('@/views/Newadd'),
      meta:{
        title:'新增地址'
      }
    },
    {
      path:'/upadd',
      name:'Upadd',
      component:()=>import('@/views/Upadd'),
      meta:{
        title:'修改地址'
      }
    },
    {
      path:'/detail/:id',
      name:'Detail',
      component:()=>import('@/views/Detail'),
      meta:{
        title:'详情'
      },
    },
    {
      path:'/help',
      name:'Help',
      component:()=>import('@/views/Help'),
      meta:{
        title:'帮助'
      }
    },
    {
      path:'/ranking',
      name:'Ranking',
      component:()=>import('@/views/Ranking'),
      meta:{
        title:'本月排名'
      }
    },
    {
      path:'/account',
      name:'Account',
      component:()=>import('@/views/Account'),
      meta:{
        title:'本月排名'
      }
    },
		{
		  path:'/order',
		  name:'Order1',
		  component:()=>import('@/views/Order'),
		  meta:{
		    title:'确认订单'
		  }
		},
    {
      path:'/blogger',
      name:'Blogger',
      component:()=>import('@/views/Blogger'),
      meta:{
        title:'博主入驻'
      }
    },
    {
      path:'/store',
      name:'Store',
      component:()=>import('@/views/Store'),
      meta:{
        title:'商家'
      }
    },
    {
      path:'/ask/:id',
      name:'Ask',
      component:()=>import('@/views/Ask'),
      meta:{
        title:'申请'
      }
    },
    {
      path:'/paysuccess',
      name:'Paysuccess',
      component:()=>import('@/views/Paysuccess'),
      meta:{
        title:'支付成功'
      }
    },
    {
      path:'/settle/:id',
      name:'Settle',
      component:()=>import('@/views/Settle'),
      meta:{
        title:'结算'
      }
    }



  ]
})

router.beforeEach((to,from,next)=>{
  if(to.meta.title){
    document.title=to.meta.title
  }
  next()
})
export default router;
